package com.etoak.controller;

import com.etoak.common.vo.ResultVO;
import com.etoak.entity.User;
import com.etoak.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    UserService userService;

    @RequestMapping("/login")
    public ResultVO login(@RequestBody User user) {
        User login = userService.login(user.getName(), user.getPassword());
        if (login != null){
            return ResultVO.success(login);
        }
        return ResultVO.error(false);
    }

}
